<template>
  <div class="sh-root">
    <div class="ss-top">
      <Headers></Headers>
      <ShangLunbo></ShangLunbo>
      <ShangFenlei></ShangFenlei>
      <Shangfen :fenlist='shangfen'></Shangfen>
    </div>
    <!-- 新人活动 -->
    <a href="https://buy.duitang.com/buy/coupon/freshman/?__urlopentype=pageweb&spm=b1" class="xin">
      <img src='../assets/lunbo/xin.png' />
    </a>
    <div>
      <Shangzhuan :zhuan = 'shangzhuans'></Shangzhuan>
    </div>
  </div>
</template>

<script>
import Headers from '../components/Headers'
import ShangLunbo from '../components/ShangLunbo'
import ShangFenlei from '../components/ShangFenlei'
import Shangfen from '../components/Shangfen'
import Shangzhuan from '../components/Shangzhuan'

export default {
  components: {
    Headers,
    ShangFenlei,
    ShangLunbo,
    Shangfen,
    Shangzhuan
  },
  data() {
    return {
      shangfen: [],  // 轮播图存放数据
      shangzhuans:[], // 存放列表分类的数据
    }
  },
  // 用于调用请求
  mounted() {
    this.requertshangfen(),
    this.requertshangzhuans()
  },
  // 用于发送请求
  methods: {
    requertshangfen() {
      this.$http('dt/napi/buy/index/module/info/?', {
        params: {
          type: [3, 4, 6],
          timestamp:1497592184000
        }
      })
        .then(function (res) {
          // console.dir(res.data.data.object_list)
          this.shangfen = res.data.data.object_list
        }.bind(this))
    },
    requertshangzhuans(){
      this.$http('dt/napi/buy/index/popular/list/?', {
        params: {
          limit:5,
          start:0,
          timestamp:1497594756000
        }
      })
        .then(function (res) {
          console.dir(res.data.data.object_list)
          this.shangzhuans = res.data.data.object_list
        }.bind(this))
    }
  }
}
</script>

<style scoped>
.sh-root {
  background-color: #F5F5F5;
}
.ss-top{
  margin-bottom:20px; 
}
.xin{
  width:60px;
  height: 70px; 
  position: fixed;
  bottom: 0px;
  right: 20px;
}
</style>
